home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
RCSC.ZIP
/
PACKAGES
/
AWK320.ZIP
/
GCD.AWK
< prev
next >
Wrap
Text File
|
1990-02-08
|
352b
|
13 lines
# calculate the Greatest common divisor of each pair of inputs
{
arg1 =$1; arg2 = $2;
while (arg1 != arg2) {
if (arg1 > arg2)
arg1 -= arg2
else
arg2 -= arg1
}
print "The greatest common divisor of", $1, "and", $2, "is", arg1
}